﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XmlServer.ServiceContracts;
using XmlServer.ServiceImplementation;

namespace MSMQOperator
{
    public class MSMQ : IOperator
    {
        /*         
         This server will take the messages and save it into a MSMQ.  It will then return a message
         to the client indicating the request has been queued.  
         
         The client will not be blocked by a long running processes; simply dump the client request as a 
         message in some MSMQ queue, and return to the client.  We could create a separate application
         that processes the messages in the queue                    
         */

        public const string SERVER_NAME = "MSMQ Operator";
        public const string SERVER_VERSION = "1.0";

        public string Name
        {
            get { return SERVER_NAME; }
        }

        public string Version
        {
            get { return SERVER_VERSION; }
        }

        public string FullName
        {
            get { return String.Format("{0}_{1}", SERVER_NAME, Version); }
        }

        public string Description
        {
            get { return "Send an email using SMTP"; }
        }

        public List<IFact> Facts
        {
            get { return null; }
        }


        public IResponse ProcessRequest(IRequest request)
        {

            var errorMsg = "I'll implement this operator later...running out of time!";

            Response response = new Response();
            response.Request = request;
            response.Facts = XmlServer.Helper.Utilities.CreateException(errorMsg);
            response.StopProcessing = System.Environment.TickCount;
            response.Success = false;
            return response;

        }



    }
}
